/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="address")
public class Address implements Serializable {
	public Address() {
	}
	
	private int id;
	
	private cn.imvc.app.entities.Member member;
	
	private String name;
	
	private cn.imvc.app.entities.Area province;
	
	private cn.imvc.app.entities.Area city;
	
	private cn.imvc.app.entities.Area county;
	
	private String address;
	
	private String telPhone;
	
	private String mobPhone;
	
	private Byte isDefault = new Byte("0");
	
	/**
	 * 地址ID
	 */
	public void setId(int value) {
		this.id = value;
	}
	
	/**
	 * 地址ID
	 */
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_ADDRESS_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_ADDRESS_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 收货人名称
	 */
	public void setName(String value) {
		this.name = value;
	}
	
	/**
	 * 收货人名称
	 */
	@Column(name="name", nullable=true, length=255)	
	public String getName() {
		return name;
	}
	
	/**
	 * 详细地址
	 */
	public void setAddress(String value) {
		this.address = value;
	}
	
	/**
	 * 详细地址
	 */
	@Column(name="address", nullable=true, length=255)	
	public String getAddress() {
		return address;
	}
	
	/**
	 * 座机电话
	 */
	public void setTelPhone(String value) {
		this.telPhone = value;
	}
	
	/**
	 * 座机电话
	 */
	@Column(name="telPhone", nullable=true, length=255)	
	public String getTelPhone() {
		return telPhone;
	}
	
	/**
	 * 手机电话
	 */
	public void setMobPhone(String value) {
		this.mobPhone = value;
	}
	
	/**
	 * 手机电话
	 */
	@Column(name="mobPhone", nullable=true, length=255)	
	public String getMobPhone() {
		return mobPhone;
	}
	
	/**
	 * 1默认收货地址
	 */
	public void setIsDefault(byte value) {
		setIsDefault(new Byte(value));
	}
	
	/**
	 * 1默认收货地址
	 */
	public void setIsDefault(Byte value) {
		this.isDefault = value;
	}
	
	/**
	 * 1默认收货地址
	 */
	@Column(name="isDefault", nullable=true)	
	public Byte getIsDefault() {
		return isDefault;
	}
	
	public void setMember(cn.imvc.app.entities.Member value) {
		this.member = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Member.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="memberId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	@org.hibernate.annotations.Index(name="member_id")	
	public cn.imvc.app.entities.Member getMember() {
		return member;
	}
	
	public void setProvince(cn.imvc.app.entities.Area value) {
		this.province = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Area.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="provinceId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Area getProvince() {
		return province;
	}
	
	public void setCity(cn.imvc.app.entities.Area value) {
		this.city = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Area.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="cityId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Area getCity() {
		return city;
	}
	
	public void setCounty(cn.imvc.app.entities.Area value) {
		this.county = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Area.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="countyId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Area getCounty() {
		return county;
	}
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("Address[ ");
			sb.append("Id=").append(getId()).append(" ");
			if (getMember() != null)
				sb.append("Member.Persist_ID=").append(getMember().toString(true)).append(" ");
			else
				sb.append("Member=null ");
			sb.append("Name=").append(getName()).append(" ");
			if (getProvince() != null)
				sb.append("Province.Persist_ID=").append(getProvince().toString(true)).append(" ");
			else
				sb.append("Province=null ");
			if (getCity() != null)
				sb.append("City.Persist_ID=").append(getCity().toString(true)).append(" ");
			else
				sb.append("City=null ");
			if (getCounty() != null)
				sb.append("County.Persist_ID=").append(getCounty().toString(true)).append(" ");
			else
				sb.append("County=null ");
			sb.append("Address=").append(getAddress()).append(" ");
			sb.append("TelPhone=").append(getTelPhone()).append(" ");
			sb.append("MobPhone=").append(getMobPhone()).append(" ");
			sb.append("IsDefault=").append(getIsDefault()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
